#!/usr/bin/env bash

set -e -o pipefail

cd $(dirname $0)/..

mkdir -vp "$(dirname ${KUBECONFIG:="${HOME}/.kube/config"})"
docker exec k3s-server-1 kubectl config view --raw | sed -e "s/127.0.0.1/${KUBEHOST:=127.0.0.1}/g" > "${KUBECONFIG}"
